package com.newtouch.bxzs.business.train.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.newtouch.bxzs.business.train.model.bo.AppExaminationListBO;
import com.newtouch.bxzs.common.base.model.Examination;

/**
 * 考试基本信息mapper
 *
 * <p>
 * <b>History:</b>
 * <table border="1">
 * <tr>
 * <th>Date</th>
 * <th>Operator</th>
 * <th>Memo</th>
 * </tr>
 * <tr>
 * <td>2021/1/21</td>
 * <td>lanwei</td>
 * <td>Create</td>
 * </tr>
 * </table>
 *
 * @author lanwei
 * @version 1.0.0
 * @since 1.0.0
 */
@Mapper
public interface ExaminationMapper extends BaseMapper<Examination> {
    /**
     * app获取考试列表
     * @param examinationType
     * @param page
     * @return
     */
    @Select("select e.EXAMINATION_ID,e.EXAMINATION_NAME,e.EXAMINATION_DURATION,e.EXAMINATION_START_TIME,e.EXAMINATION_END_TIME,p.EXAMINATION_QUESTIONS_NUMBER,e.UPDATE_TIME"  
            +" FROM ASSISTANT_EXAMINATION e LEFT JOIN ASSISTANT_EXAMINATION_PAPER p ON e.EXAMINATION_PAPER_ID=p.EXAMINATION_PAPER_ID"
            +" and e.IS_DELETE=0 AND p.IS_DELETE=0 WHERE e.EXAMINATION_TYPE=#{examinationType} ORDER BY e.UPDATE_TIME DESC")
    IPage<AppExaminationListBO> getAppExaminationList(@Param("examinationType")String examinationType,@Param("page")Page<AppExaminationListBO> page);
}
